//index.js
const {
  initFun
} = require('../../utils/util')
const HttpModule = require("../../utils/httpModule");

getApp().httpModule = new HttpModule()
Page({
  async onShow() {
    wx.showLoading({
      title: '加载中',
    });
    wx.showNavigationBarLoading()
    initFun() //日期格式化函数
    //do noting
    const getUserStatus = await getApp().httpModule.getUserStatus();
    const status = getUserStatus.data.getUserStatus.state
    wx.hideLoading();
    wx.hideNavigationBarLoading()
    //  状态0成功/1审核中/2未注册
    switch (status) {
      case 1:
        wx.redirectTo({
          url: '/pages/daka/index',
        })
        break;
      case 2:
        wx.redirectTo({
          url: '/pages/shenhe/index',
        })
        break;
      case 0:
        wx.redirectTo({
          url: '/pages/zhuce/index',
        })
        break;
      case 3:
        wx.redirectTo({
          url: '/pages/mar/marPhoto/index',
        })
        break;
      default:
        wx.setNavigationBarTitle({
          title: `状态错误`
        })
        wx.showModal({
          title: '提示',
          content: `状态错误:${status}`
        })
        break;
    }
  }
})